/**
 * This class provides the modal Ext.Window support for all Authentication forms.
 * It's layout is structured to center any Authentication dialog within it's center,
 * and provides a backGround image during such operations.
 */
Ext.define('Monkey.view.code.TemplateWindow', {
    extend: 'Ext.window.Window',
    xtype: 'templatewindow',

    requires: [],

    controller: 'ctrl-codetemplate',
    viewModel: 'vm-codetemplate',
    closable: true,
    resizable: false,
    constrain: true,
    constrainHeader: true,
    modal: true,
    frameHeader: false,
    frame: true,
    maximizable: false,
    layout: 'fit',
    width: 360,
    height: 320,
    initComponent: function () {
        var form = {
            xtype: 'form',
            border: false,
            buttonAlign: 'center',
            reference: 'form',
            layout: 'form',
            bodyStyle: 'padding:15px 5px 0 5px',
            defaults: {
                labelWidth: 80,
                labelAlign: 'right'
            },
            defaultType: 'textfield',
            buttons: [{
                formBind: true,
                text: '确定',
                iconCls: 'accept',
                handler: 'ok'
            }, {
                text: '取消',
                iconCls: 'delete',
                handler: 'cancel'
            }]
        };


        form.items = [{
            bind: '{name}',
            name: 'name',
            allowBlank: false,
            fieldLabel: '<span style="color: red">*</span>模版名'
        }, {
            bind: '{packagePath}',
            name: 'packagePath',
            allowBlank: false,
            fieldLabel: '<span style="color: red">*</span>包路径'
        }, {
            bind: '{className}',
            name: 'className',
            allowBlank: false,
            fieldLabel: '<span style="color: red">*</span>类名'
        }, {
            bind: '{view}',
            name: 'view',
            allowBlank: false,
            fieldLabel: '<span style="color: red">*</span>参数配置视图'
        }/*, {
            bind: '{picture}',
            name: 'picture',
            fieldLabel: '预览图',
            xtype: 'filefield',
            labelWidth: 50,
            allowBlank: false,
            buttonConfig: {
                iconCls: 'picture-add',
                text:'选择图片'
            }
        }*/, {
            bind: '{remark}',
            name: 'remark',
            xtype: 'textareafield',
            grow: true,
            fieldLabel: '备注'
        }, {
            bind: '{id}',
            name: 'id',
            xtype: 'hidden'
        }];

        this.items = [form];
        this.callParent();
    }
});
